(function() {
    var bottomSwitch = {
        init: function(page, todoList) {
            this.page = page;
            this.todoList = todoList;
            this.isGray = false;
        },
        show: function() {
            var renderData = this.page.getRenderData();
            renderData.bottomSwitchDisplay = 'block';
        },
        hide: function() {
            var renderData = this.page.getRenderData();
            renderData.bottomSwitchDisplay = 'none';
        },
        setText: function(text) {
            this.text = text;
            var renderData = this.page.getRenderData();
            renderData.bottomSwitchText = text;
        },
        moveY: function(y) {
            this.y = y;
            var animation = wx.createAnimation({duration:0});
            animation.translateY(y).step();
            var renderData = this.page.getRenderData();
            renderData.bottomSwitchAnimation = animation.export();
        },
        gray: function() {
            if (!this.isGray) {
                this.isGray = true;
            }
            var renderData = this.page.getRenderData();
            renderData.bottomSwitchColor = '#333';
        },
        unGray: function() {
            if (this.isGray) {
                this.isGray = false;
            }
            var renderData = this.page.getRenderData();
            renderData.bottomSwitchColor = '#FFF';
        },
    };

    function createBottomSwitch() {
        return Object.create(bottomSwitch);
    }

    module.exports = {
        createBottomSwitch:createBottomSwitch
    }
})();